using UnityEngine;
using System.Collections;

public class Camera : MonoBehaviour {
	
	public GameObject Target;
	public float time;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
		SeguirTargetLerp(this.Target);
		
	}
	
	void SeguirTarget(GameObject Target)
	{
		transform.position =  Target.transform.position;
	}
	
	
	void SeguirTargetLerp(GameObject Target)
	{
		Vector3 diff = Target.transform.position - transform.position;
		float Mdiff = (diff.x+diff.y)/2;
		
		if(Mdiff < 0)
			Mdiff *= -1;
		
		Vector3 VectorTemp = Vector3.Lerp(transform.position, Target.transform.position, Mdiff);
		transform.position = new Vector3(VectorTemp.x, VectorTemp.y, transform.position.z);
	}
}
